package com.kitchen.api.controller;


import com.kitchen.beans.vo.CollectVo;
import com.kitchen.common.vo.ResultVO;
import com.kitchen.service.CollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

@CrossOrigin
@RestController
@RequestMapping("/collect")
@Api(value = "提供用户收藏的接口",tags = "收藏管理")
public class CollectController {

    @Resource
    private CollectService collectService;

    @PostMapping("/add")
    @ApiOperation("用户收藏菜单接口")
    public ResultVO add(@RequestBody CollectVo collectVo){
        ResultVO add = collectService.add(collectVo.getuId(), collectVo.getfId());
        return add;
    }
    @PostMapping("/delete")
    @ApiOperation("用户删除收藏接口")
    private ResultVO delete(@RequestBody CollectVo collectVo){
        ResultVO delete = collectService.delete(collectVo.getCoids());
        return delete;
    }
    @PostMapping("/list")
    @ApiOperation("用户显示收藏接口")
    private ResultVO list(@RequestBody CollectVo collectVo){
        ResultVO list = collectService.list(collectVo.getuId());
        return list;
    }
}
